import request from '@/config/axios'

// 商品分类 VO
export interface ProductCategoryVO {
  id: number // 主键
  status: number // 状态
  picUrl: string // 图片路径
  seq: number // 显示顺序
  parentId: number // 父集ID
  createUserId: number // 创建人
  name: string // 分类名称
  thirdCategory: string // 三方分类
  thirdCategoryParent: string // 三方上级分类
}

// 商品分类 API
export const ProductCategoryApi = {
  // 查询商品分类分页
  getProductCategoryPage: async (params: any) => {
    return await request.get({ url: `/team/product-category/page`, params })
  },

  // 查询商品分类详情
  getProductCategory: async (id: number) => {
    return await request.get({ url: `/team/product-category/get?id=` + id })
  },

  // 新增商品分类
  createProductCategory: async (data: ProductCategoryVO) => {
    return await request.post({ url: `/team/product-category/create`, data })
  },

  // 修改商品分类
  updateProductCategory: async (data: ProductCategoryVO) => {
    return await request.put({ url: `/team/product-category/update`, data })
  },

  // 删除商品分类
  deleteProductCategory: async (id: number) => {
    return await request.delete({ url: `/team/product-category/delete?id=` + id })
  },

  // 导出商品分类 Excel
  exportProductCategory: async (params) => {
    return await request.download({ url: `/team/product-category/export-excel`, params })
  },
  // 查询商品分类分页
  getProductCategoryList: async (params: any) => {
    return await request.get({ url: `/team/product-category/getProductCategoryListByPid`, params})
  }
}